home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 February / february_2000.iso / site building / GoLive 4.0 Tryout / data1.cab / Apps / Modules / JScripts / ActionScripts / BrwsrSwtch.scpt < prev    next >
Encoding:
Text File  |  1999-08-05  |  1001 b   |  45 lines

  1. function CSBrowserSwitch(action) {
  2.     var bAgent    = window.navigator.userAgent;
  3.     var bAppName    = window.navigator.appName;
  4.  
  5.     var isNS        = (bAppName.indexOf("Netscape") >= 0);
  6.     var isIE        = (bAppName.indexOf("Explorer") >= 0);
  7.     var isWin        = (bAgent.indexOf("Win") >= 0); 
  8.     var isMac        = (bAgent.indexOf("Mac") >= 0); 
  9.  
  10.     var vers        = 0;
  11.     var versIdx    = (bAgent.indexOf("Mozilla/"));
  12.  
  13.     if(versIdx >= 0)
  14.         {
  15.         var sstr    = bAgent.substring(versIdx + 8, versIdx + 9);
  16.         vers        = parseInt(sstr) - 2;
  17.         }
  18.  
  19.     var url        = action[1];
  20.     var platform    = action[2];
  21.  
  22.     var versVec;
  23.     if(platform)
  24.         {
  25.         if(isNS && isMac) versVec = action[3];
  26.         if(isIE && isMac) versVec = action[4];
  27.         if(isNS && isWin) versVec = action[5];
  28.         if(isIE && isWin) versVec = action[6];
  29.         }
  30.     else
  31.         {
  32.         if(isNS) versVec = action[3];
  33.         if(isIE) versVec = action[4];
  34.         }
  35.  
  36.     if(vers > (versVec.length-1))
  37.         vers = versVec.length-1;
  38.     if(versVec[vers] == 0)
  39.         {
  40.         location            = url;
  41.         CSStopExecution    = true;    
  42.         }
  43. }
  44.  
  45.